﻿// Copyright (c) Inossem. All rights reserved.
// Licensed under the LGPL-3.0 license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace DWF.Studio.Project
{
    /// <summary>
    /// 工程节点基类
    /// </summary>
    internal abstract class ProjectNode : DependencyObject
    {
        /// <summary>
        /// 名称
        /// </summary>
        public string Name
        {
            get;
            set;
        }

        /// <summary>
        /// 显示名称
        /// </summary>
        public string DisplayName
        {
            get { return (string)GetValue(DisplayNameProperty); }
            set { SetValue(DisplayNameProperty, value); }
        }

        /// <summary>
        /// 亲节点
        /// </summary>
        public ProjectNode Parent
        {
            set;
            get;
        }

        /// <summary>
        /// 图片资源
        /// </summary>
        public Uri IconLoc
        {
            get;
            set;
        }

        /// <summary>
        /// 全名
        /// </summary>
        public string FullName
        {
            get;
            set;
        }

        /// <summary>
        /// 节点类型
        /// </summary>
        public EProjectNodeType NodeType
        {
            get;
            protected set;
        }

        /// <summary>
        /// 是否是固有节点
        /// </summary>
        public bool IsSelf
        {
            get;
            protected set;
        }

        /// <summary>
        /// 是否存在
        /// </summary>
        public bool IsExisting
        {
            get { return (bool)GetValue(IsExistingProperty); }
            set { SetValue(IsExistingProperty, value); }
        }

        public abstract ObservableCollection<ProjectNode> Children
        {
            get;
            set;
        }

        /// <summary>
        /// 是否展开
        /// </summary>
        public bool IsExpanded
        {
            get { return (bool)GetValue(IsExpandedProperty); }
            set { SetValue(IsExpandedProperty, value); }
        }

        /// <summary>
        /// 提示信息
        /// </summary>
        public string ToolTip
        {
            get { return (string)GetValue(ToolTipProperty); }
            set { SetValue(ToolTipProperty, value); }
        }
        
        /// <summary>
        /// 显示名称
        /// </summary>
        public static readonly DependencyProperty DisplayNameProperty = DependencyProperty.Register("DisplayName", typeof(string), typeof(ProjectNode));
        /// <summary>
        /// 提示
        /// </summary>
        public static readonly DependencyProperty ToolTipProperty = DependencyProperty.Register("ToolTip", typeof(string), typeof(ProjectNode));
        /// <summary>
        /// 是否展开
        /// </summary>
        public static readonly DependencyProperty IsExpandedProperty = DependencyProperty.Register("IsExpanded", typeof(bool), typeof(ProjectNode));
        /// <summary>
        /// 是否存在
        /// </summary>
        public static readonly DependencyProperty IsExistingProperty = DependencyProperty.Register("IsExisting", typeof(bool), typeof(ProjectNode));
    }
}
